package com.aspose.cells;

import java.util.ArrayList;

class zbuv {
   private zane a;
   private zane b;
   private VbaProject c;
   private byte[] d;
   private int e;
   private int f = 0;
   private byte[] g = new byte[6];
   private static final com.aspose.cells.b.c.a.za h = new com.aspose.cells.b.c.a.za(new String[]{"ID", "Document", "Module", "Class", "BaseClass", "Package", "ExeName32", "HelpFile", "Name", "ProjectHelpId", "ProjectDescription", "VersionCompatible32", "CMG", "DPB", "GC", "I", "Z"});

   zbuv(VbaProject var1, zane var2) {
      this.c = var1;
      this.b = var2;
      this.a = var2.b("VBA");
      var2.g("VBA");
   }

   void a() throws Exception {
      this.e();
      this.b();
      this.d();
      this.c();
   }

   private void a(com.aspose.cells.b.a.d.zm var1, int var2) throws Exception {
      this.f = com.aspose.cells.b.a.zc.a(this.g, 2);
      this.d = new byte[this.f + var2];
      var1.a(this.d, 0, this.d.length);
   }

   void b() throws Exception {
      com.aspose.cells.b.a.d.zh var1 = this.a.a("dir");
      this.a.g("dir");
      com.aspose.cells.b.a.d.zm var5 = zbuy.a(var1, 0);
      var5.a(0L, 0);
      int var2 = 0;
      VbaModule var3 = null;

      while(var5.a(this.g, 0, 6) == 6) {
         this.e = com.aspose.cells.b.a.zc.e(this.g, 0) & '\uffff';
         this.a(var5, this.e == 9 ? 2 : 0);
         switch(this.e) {
         case 1:
            this.c.a = this.d[0] & 255;
         case 2:
         case 10:
         case 11:
         case 16:
         case 17:
         case 18:
         case 20:
         case 21:
         case 23:
         case 24:
         case 27:
         case 29:
         case 31:
         case 32:
         case 35:
         case 36:
         case 38:
         case 39:
         case 41:
         case 42:
         case 45:
         case 46:
         case 52:
         case 53:
         case 54:
         case 55:
         case 56:
         case 57:
         case 58:
         case 59:
         case 63:
         case 65:
         case 66:
         case 67:
         case 68:
         case 69:
         case 70:
         default:
            break;
         case 3:
            this.c.b = Encoding.getEncoding(com.aspose.cells.b.a.zc.e(this.d, 0) & '\uffff');
            break;
         case 4:
            this.c.d = this.c.b.a(this.d);
            break;
         case 5:
            this.c.e = this.c.b.a(this.d);
            break;
         case 6:
            this.c.f = this.c.b.a(this.d);
            break;
         case 7:
            this.c.h = com.aspose.cells.b.a.zc.a(this.d, 0);
            break;
         case 8:
            this.c.i = com.aspose.cells.b.a.zc.a(this.d, 0);
            break;
         case 9:
            this.c.j = com.aspose.cells.b.a.zc.a(this.d, 0);
            this.c.k = com.aspose.cells.b.a.zc.b(this.d, 4);
            break;
         case 12:
            this.c.l = this.c.b.a(this.d);
            break;
         case 13:
         case 14:
         case 22:
         case 47:
         case 48:
         case 51:
         case 62:
            byte[] var4 = new byte[this.f + 6];
            System.arraycopy(this.g, 0, var4, 0, 6);
            System.arraycopy(this.d, 0, var4, 6, this.f);
            if (this.c.m == null) {
               this.c.m = new ArrayList();
            }

            com.aspose.cells.b.a.a.ze.a(this.c.m, (Object)var4);
            break;
         case 15:
            var2 = com.aspose.cells.b.a.zc.e(this.d, 0) & '\uffff';
            if (var2 == 0) {
               return;
            }

            var3 = new VbaModule(this.c);
            this.c.getModules().a(var3);
            break;
         case 19:
            this.c.getModules().b = com.aspose.cells.b.a.zc.b(this.d, 0);
            break;
         case 25:
            var3.a = this.c.b.a(this.d);
            break;
         case 26:
            var3.c = this.c.b.a(this.d);
            break;
         case 28:
            var3.d = this.c.b.a(this.d);
            break;
         case 30:
            var3.f = com.aspose.cells.b.a.zc.a(this.d, 0);
            break;
         case 33:
            var3.h = 0;
            break;
         case 34:
            var3.h = 1;
            break;
         case 37:
            var3.i = true;
            break;
         case 40:
            var3.j = true;
            break;
         case 43:
            --var2;
            if (var2 != 0) {
               var3 = new VbaModule(this.c);
               this.c.getModules().a(var3);
            }
            break;
         case 44:
            var3.g = com.aspose.cells.b.a.zc.b(this.d, 0);
            break;
         case 49:
            var3.e = com.aspose.cells.b.a.zc.a(this.d, 0);
            break;
         case 50:
            var3.c = Encoding.getUnicode().a(this.d);
            break;
         case 60:
            this.c.l = Encoding.getUnicode().a(this.d);
            break;
         case 61:
            this.c.g = this.c.b.a(this.d);
            break;
         case 64:
            this.c.e = Encoding.getUnicode().a(this.d);
            break;
         case 71:
            var3.a = Encoding.getUnicode().a(this.d);
            break;
         case 72:
            var3.d = Encoding.getUnicode().a(this.d);
         }
      }

   }

   void c() throws Exception {
      for(int var1 = 0; var1 < this.c.getModules().getCount(); ++var1) {
         VbaModule var2 = this.c.getModules().get(var1);
         String var3 = var2.c;
         com.aspose.cells.b.a.d.zh var4 = this.a.a(var3);
         this.a.g(var3);
         byte[] var5 = new byte[(int)var4.h()];
         var4.a(var5, 0, var5.length);
         var2.k = var5;
      }

   }

   void d() throws Exception {
      com.aspose.cells.b.a.d.zh var1 = this.b.a("PROJECT");
      this.b.g("PROJECT");
      com.aspose.cells.b.a.d.zn var2 = new com.aspose.cells.b.a.d.zn(var1);

      String var6;
      String var15;
      while(var2.c() != -1) {
         String var3 = var2.f();
         if (var3 != null && !"".equals(var3)) {
            if ("[Host Extender Info]".equals(var3) || "[Workspace]".equals(var3)) {
               break;
            }

            int var4 = var3.indexOf(61);
            String var5 = var3.substring(0, 0 + var4).trim();
            var6 = var3.substring(var4 + 1).trim();
            VbaModule var14;
            switch(h.a(var5)) {
            case 0:
               this.c.r = var6.substring(1, 1 + (var6.length() - 2));
               break;
            case 1:
               var4 = var6.indexOf("/");
               var15 = var6.substring(0, 0 + var4).trim();
               String var8 = var6.substring(var4 + 1).trim();
               VbaModule var9 = this.c.getModules().get(var15);
               if (var9 != null) {
                  var9.h = 1;
                  var9.b = com.aspose.cells.a.c.zp.c(var8.substring(2));
               }
               break;
            case 2:
               var14 = this.c.getModules().get(var6);
               if (var14 != null) {
                  var14.h = 0;
               }
               break;
            case 3:
               var14 = this.c.getModules().get(var6);
               if (var14 != null) {
                  var14.h = 2;
               }
               break;
            case 4:
               var14 = this.c.getModules().get(var6);
               if (var14 != null) {
                  var14.h = 3;
               }
               break;
            case 5:
               this.c.c().a(var5, var6);
               break;
            case 6:
               this.c.c = var6;
            case 7:
            case 8:
            case 9:
            case 10:
            default:
               break;
            case 11:
               this.c.s = var6.substring(1, 1 + (var6.length() - 2));
               break;
            case 12:
               this.c.t |= (byte)(zbuy.a(var6.substring(1, 1 + (var6.length() - 2)))[0] & 255 & 7);
               break;
            case 13:
               byte[] var7 = zbuy.a(var6.substring(1, 1 + (var6.length() - 2)));
               if (var7.length > 1) {
                  this.c.u = var7;
               }
               break;
            case 14:
               if (zbuy.a(var6.substring(1, 1 + (var6.length() - 2)))[0] == 0) {
                  this.c.b(false);
               }
            }
         }
      }

      zbuu var11 = this.c.d();
      var11.clear();

      String var12;
      int var13;
      while(var2.c() != -1) {
         var12 = var2.f();
         if (var12 != null && !"".equals(var12)) {
            if ("[Workspace]".equals(var12)) {
               break;
            }

            var13 = var12.indexOf(61);
            var6 = var12.substring(0, 0 + var13).trim();
            var15 = var12.substring(var13 + 1).trim();
            var11.a(var6, var15);
         }
      }

      while(var2.c() != -1) {
         var12 = var2.f();
         if (var12 != null && !"".equals(var12)) {
            var13 = var12.indexOf(61);
            var6 = var12.substring(0, 0 + var13);
            var15 = var12.substring(var13 + 1);
            VbaModule var16 = this.c.getModules().get(var6);
            if (var16 != null) {
               String[] var17 = com.aspose.cells.b.a.zv.d(var15, ',');
               zbuw var10 = var16.m;
               if (var17.length >= 4) {
                  var10.a = com.aspose.cells.a.c.zp.b(var17[0].trim());
                  var10.b = com.aspose.cells.a.c.zp.b(var17[1].trim());
                  var10.c = com.aspose.cells.a.c.zp.b(var17[2].trim());
                  var10.d = com.aspose.cells.a.c.zp.b(var17[3].trim());
                  if (var17.length >= 5) {
                     switch(h.a(var17[4].trim())) {
                     case 15:
                        var10.e = 2;
                        break;
                     case 16:
                        var10.e = 1;
                        break;
                     default:
                        var10.e = 0;
                     }
                  }
               }
            }
         }
      }

   }

   void e() {
      this.b.g("PROJECTwm");
   }
}
